/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package 垃.圾;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;

/**
 *
 * @author EnzoZhong
 */
public class MP5 extends Gun {

   /**
    *
    * @param target
    * @param port
    * @param bullet
    */
   public MP5 ( String target , int port , byte[] bullet ) {
      super( target , port , bullet );
   }

   /**
    *
    * @param target
    * @param bullet
    */
   public MP5 ( String target , byte[] bullet ) {
      super( target , bullet );
   }

   @Override
   public void run () {
      try {
         Socket s = new Socket( InetAddress.getByName( this.getTarget() ) , this.getPort() );
         OutputStream os = s.getOutputStream();
         os.write( this.getBullet() );
         os.flush();
//         InputStream is = s.getInputStream();
//         InputStreamReader in = new InputStreamReader( is );
//         BufferedReader bin = new BufferedReader( in );
         System.err.println( " MP5 OK " + this.getPort() );
      } catch ( IOException ex ) {
//         System.out.println( ex );
//         System.out.println( "MP5 MISS " + this.getPort() );
      }

   }
}
